#pragma once
#include<stdio.h>
#include<time.h>
#include <websocketpp/server.hpp>
#include <websocketpp/config/asio_no_tls.hpp>
#include"util.h"

typedef websocketpp::server<websocketpp::config::asio> wsserver_t;
#define INF 0
 #define DBG 1
 #define ERR 2
 #define LOG_LEVEL INF
#define Log(level,f,...) do{\
     if (level < LOG_LEVEL) break;\
    time_t t=time(nullptr);\
      struct tm *ltm = localtime(&t);\
      char tmp[32] = {0};\
    strftime(tmp, 31, "%H:%M:%S", ltm);\
    fprintf(stdout,"[%s,%s:%d]" f "\n",tmp, __FILE__, __LINE__, ##__VA_ARGS__);\
}while(0)

#define INF_Log(format,...) Log(INF,format, ##__VA_ARGS__)
#define DBG_Log(format,...) Log(DBG,format, ##__VA_ARGS__)
#define ERR_Log(format,...) Log(ERR,format, ##__VA_ARGS__)




